import { container } from "shared/component/container/ContainerService";
import Log4R from "shared/component/log/Log4R";
import { ColiGroup } from "shared/enums/ColiGroup";
import "./serverLib";

import "./characterServerListener";

import "./directerServerListener";

import "./scenceServerListener";


const log = Log4R.getLog('info');
// 设置碰撞组
const physicsService = game.GetService('PhysicsService')
physicsService.RegisterCollisionGroup(ColiGroup.player)
physicsService.RegisterCollisionGroup(ColiGroup.trigger)
physicsService.RegisterCollisionGroup(ColiGroup.no)
physicsService.RegisterCollisionGroup(ColiGroup.character)
physicsService.RegisterCollisionGroup(ColiGroup.playerHumanRootPart)
physicsService.RegisterCollisionGroup(ColiGroup.playerHumanRootPartDodge)
physicsService.RegisterCollisionGroup(ColiGroup.nojump)
physicsService.RegisterCollisionGroup(ColiGroup.characterJump)
physicsService.CollisionGroupSetCollidable(ColiGroup.player, ColiGroup.player, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.trigger, ColiGroup.Default, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.trigger, ColiGroup.player, true)

physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPart, ColiGroup.playerHumanRootPartDodge, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPartDodge, ColiGroup.playerHumanRootPartDodge, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.playerHumanRootPart, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.playerHumanRootPartDodge, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.Default, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.playerHumanRootPart, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.playerHumanRootPartDodge, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.Default, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.character, ColiGroup.character, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.characterJump, ColiGroup.characterJump, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPart, ColiGroup.playerHumanRootPart, true)
physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPart, ColiGroup.character, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPartDodge, ColiGroup.character, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPart, ColiGroup.characterJump, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.playerHumanRootPartDodge, ColiGroup.characterJump, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.Default, ColiGroup.playerHumanRootPart, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.Default, ColiGroup.playerHumanRootPartDodge, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.Default, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.no, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.character, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.characterJump, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.playerHumanRootPart, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.playerHumanRootPartDodge, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.no, ColiGroup.nojump, false)

physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.Default, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.nojump, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.character, true)//不跳时碰撞
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.characterJump, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.playerHumanRootPart, false)
physicsService.CollisionGroupSetCollidable(ColiGroup.nojump, ColiGroup.playerHumanRootPartDodge, false)
//-------初始化服务---------

container.register();
//-------注册事件--------
//----------------------
/* 启动 */
container.activeServices();